package csdn.chouxiang.li04;

public class Test {
    public static void main(String[] args) {
    Monkey monkey=new Monkey("棕色",2,"悟空");
        monkey.eat();;
        monkey.sleep();
        monkey.toString();
        monkey.jump();
        monkey.cycle();
    //多态
    Animal monkey1=new Monkey("棕色",2,"悟空");
    //方法：编译看左边，运行看右边
        monkey1.eat();
        monkey1.sleep();
        monkey1.toString();
        //monkey1.jump();
        //monkey1.cycle();
        //需要向下转型
        Monkey monkey2=(Monkey)monkey1;
        monkey2.jump();
        monkey2.cycle();
//------------------------------------------
        //接口的访问，问题：接口中可以重写toString吗？
        //不可以
    }
}
